﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_pj_teacher : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        rpTest.DataSource = pds();
        rpTest.DataBind();
    }
    protected PagedDataSource pds()
    {
        OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0 ;Data Source=|DataDirectory|\\web.mdb");
        con.Open();
        OleDbCommand cmd = new OleDbCommand("select * from ty_teacher", con);
        OleDbDataAdapter sda = new OleDbDataAdapter();
        sda.SelectCommand = cmd;
        DataSet ds = new DataSet();
        sda.Fill(ds, "ty_teacher");
        PagedDataSource pds = new PagedDataSource();
        pds.DataSource = ds.Tables["ty_teacher"].DefaultView;//必须设为DefaultView,不能设置成Table
        con.Close();
        return pds;
    }
   
 
}
 
